<?php
class account extends Zend_Db_Table
{

	protected $_schema='softlab';
	protected $_name='account';
	protected $_primary='AId';
	protected $_sequence=true;

	// account wrapper
	protected $wr;

	public function __construct()
	{
		$config=array('db'=>'database');

		$this->wr=new wrapper('AId|User|Pass|Priv|Sort|Status|Name|Icon'.
					'|Race|Birth|Sex|Education|Title|Intro|Interest|MSN'.
					'|Email|Tel|Home|Blog|QQ|Job',
				array('AId'=>'/[0-9]+/',
					'Pass'=>'/(.+)/',
					'Priv'=>'/[0-9]+/',
					'Sort'=>'/[0-9]+/',
					'User'=>'/^.{4,16}$/',
					'Name'=>'/^.{4,16}$/'),
				'AId|Priv');
		
		parent::__construct($config);
	}

	function insert(array $data)
	{
		return parent::insert($this->wr->filter($data));
	}

	// 过滤掉不再表中的参数
	public function filter($data)
	{
		return $this->wr->filter($data);
	}

	// 出错字段
	public function err_field()
	{
		return $this->wr->field;
	}

};
?>
